using System.Web.UI.WebControls;
using System.Web.UI;
namespace Acms.WebControls
{
    public class StyleSheet : WebControl
    {

        public string Path { get; set; }

        protected override void Render(HtmlTextWriter writer)
        {
            if (this.Visible)
            {
                if (!string.IsNullOrEmpty(Path))
                {
                    string resolverPath = null;
                    if (this.NamingContainer is MasterPage)
                    {
                        resolverPath = this.Page.Master.ResolveUrl(Path);
                    }
                    else
                    {
                        resolverPath = this.Page.ResolveUrl(Path);
                    }
                    writer.Write(string.Format("<link href=\"{0}\" rel=\"stylesheet\" type=\"text/css\" media=\"{1}\"/>", resolverPath, Media.ToString().ToLower()));
                }
            }
        }

        public MediaType Media { get; set; }
        public enum MediaType
        {
            Screen,
            Print
        }


    }
}
